﻿#include"bstree.h"
int main() {
	//using namespace K;
	//
	//bstree<int> bs;
	//int a[] = { 8, 3, 1, 10, 1, 6, 4, 7, 14, 13 };
	//for (auto e : a) {
	//	bs.insert(e);
	//}
	//bs.inorder();
	////cout << bs.find(100)<< endl;
	///*for (auto e : a)
	//		{
	//		bs.erase(e);
	//			bs.inorder();
	//		}*/
	//bstree <int> b;
	//b.insert(2);
	//b.inorder();
	//b = bs;
	//b.inorder();
	//bs.inorder();

	using namespace K_Value;

	//字典查询：
	/*bstree<string, string> b;
	b.insert("left", "左边");
	b.insert("right", "右边");
	b.insert("insert", "插⼊");
	b.insert("string", "字符串");
	string str;
	while (cin >> str)
	{
		auto ret = b.find(str);
		if (ret)
		{
			cout << "->" << ret->_value << endl;
		}
		else
		{
			cout << "无此单词，请重新输入" << endl;
		}
	}*/





	string arr[] = { "苹果", "西瓜", "苹果", "西瓜", "苹果", "苹果", "西瓜",
"苹果", "柠檬", "苹果", "柠檬","橘子"};
	bstree<string, int> countTree;
	for (const auto& str : arr)
	{
		auto ret = countTree.find(str);
		if (ret == NULL)
		{
			countTree.insert(str, 1);
		}
		else
		{
			ret->_value++;
		}
	}
	countTree.inorder();


	return 0;
}